<%@ page import="com.aiwei.tdjk.enums.SaleOrderStatusEnum" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/template/common/taglibs.jspf" %>
<es:contentHeader/>


<t:base type="jquery,jquery-ui-bootstrap:bootstrap,jquery-ui-bootstrap:jquery-ui,query-ui-bootstrap:jquery.layout,jquery-ui-bootstrap:font-awesome"></t:base>
<t:base type="jquery-ui-bootstrap:jquery.blockUI,jquery-ui-bootstrap:bootstrap.file-input,bootstrap-datetimepicker,jQuery-Validation-Engine,nicescroll,application"></t:base>


<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/box.css"/>



<div class="box border purple" style="">
    <div class="box-title">
        <h4><i class="fa fa-bars"></i>海关手册详情列表</h4>
        <div class="tools">
            <a href="#box-config" data-toggle="modal" class="config">
                <i class="fa fa-cog"></i>
            </a>
            <a href="javascript:;" class="reload">
                <i class="fa fa-refresh"></i>
            </a>
            <a href="javascript:;" class="collapse">
                <i class="fa fa-chevron-up"></i>
            </a>
            <a href="javascript:;" class="remove">
                <i class="fa fa-times"></i>
            </a>
        </div>
    </div>

    <div class="box-body" style="display: block;">

        <div data-table="table" class="panel">

            <es:showMessage/>


            <div class="row-fluid tool ui-toolbar">
                <div class="span3">
                    <div class="btn-group">
                        <%-- 当拥有所有权限时才能使用 --%>
                        <shiro:hasPermission name="sys:user:create">
                            <a class="btn no-disabled btn-create">
                                <span class="icon-file-alt"></span>
                                新增
                            </a>
                        </shiro:hasPermission>
                        <shiro:hasPermission name="sys:user:update">
                            <a id="update" class="btn btn-update">
                                <span class="icon-edit"></span>
                                修改
                            </a>
                        </shiro:hasPermission>

                        <a class="btn btn-delete">
                            <span class="icon-trash"></span>
                            删除
                        </a>

                    </div>
                </div>
                <div class="span9">
                    <%--<%@include file="searchForm.jsp" %>--%>
                </div>
            </div>

            <table id="table" class="sort-table table table-bordered table-hover datatable_single table-striped"
                   data-prefix-url="<%=request.getContextPath()%>/admin/customsHandbookProductdetail">
                <thead>
                <tr>
                    <th style="width: 80px;">
                        <a class="check-all" href="javascript:;">全选</a>
                        |
                        <a class="reverse-all" href="javascript:;">反选</a>
                    </th>
                    <th sort="itemCode">项号</th>
                    <th sort="specifications">规格</th>
                    <th sort="recordQty">备案数量</th>
                    <th sort="leftQty">剩余量</th>
                    <th sort="forzenQty">冻结量</th>
                    <th>未冻结量</th>
                    <th sort="singleWeight">单重</th>
                    <th>备案重量</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="m">
                    <tr>

                        <td class="check">
                            <input type="checkbox" name="ids" value="${m.id}" />
                        </td>
                        <td>${m.itemCode}</td>
                        <td>${m.specifications}</td>
                        <td>${m.recordQty}</td>
                        <td>${m.recordQty-m.hasDeclareQty}</td>
                        <td>${m.hasDeclareQty+m.hasNotDeclareQty}</td>
                        <td>${m.recordQty-m.hasDeclareQty-m.hasNotDeclareQty}</td>
                        <td>${m.singleWeight}</td>
                        <td>${m.recordWeight}</td>

                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <es:page page="${page}"/>
        </div>

    </div>
</div>


<es:contentFooter/>
<%@include file="/WEB-INF/template/common/admin/import-sys-js.jspf" %>
<script type="text/javascript">
    $(function () {

        $(".btn-create").click(function() {
            var url = ctx + "/admin/customsHandbookProductdetail/create?customsHandBookId=" +${customsHandbookProductdetail.customsHandBookId};
            window.location.href =url;
        });



        $(".rentShip").click(function() {
            var checkbox = $.table.getAllSelectedCheckbox($(".table"));
            if(!checkbox.length) return;
            if(checkbox.size() >1) {
                $.app.alert({
                    message : "只能选中一条记录！",
                })
                return;
            }

            var last = $("tr.active").first().children("td").last();
            console.log(last.html().trim())
            if (last.html().trim()=="已订舱"){
                $.app.alert({
                    message : "不能够重复订舱！",
                })
                return;
            }
            var id = checkbox.val();
            var url = ctx + "/admin/bookingContainer/create?" + checkbox.serialize();
            window.location.href =url;
        });
    });
</script>

